﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:props="clr-namespace:ScrumFactory.Windows.Properties"
                    xmlns:sys="clr-namespace:System;assembly=mscorlib">


    <Style TargetType="{x:Type ListBoxItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">                    
                        <Border Style="{StaticResource MouseOverBorder}" Padding="2">
                          <ContentPresenter x:Name="content" />
                        </Border>                    
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="{x:Type ListBoxItem}" x:Key="NoHoverListBoxItem">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">                    
                        <ContentPresenter x:Name="content" />                    
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Storyboard x:Key="RemoveItemStoryBoard">        
        <DoubleAnimation
                Duration="00:00:0.1" From="1" To="0"                                            
                Storyboard.TargetProperty="(ListBoxItem.RenderTransform).(ScaleTransform.ScaleY)" />
    </Storyboard>

    <Storyboard x:Key="InsertItemStoryBoard">        
        <DoubleAnimation
                Duration="00:00:0.2" From="0" To="1"                                            
                Storyboard.TargetProperty="(ListBoxItem.RenderTransform).(ScaleTransform.ScaleY)" />
    </Storyboard>

    <Storyboard x:Key="RemoveListViewItemStoryBoard">
        <DoubleAnimation
                Duration="00:00:0.1" From="1" To="0"                                            
                Storyboard.TargetProperty="(ListBoxItem.RenderTransform).(ScaleTransform.ScaleY)" />
    </Storyboard>

    <Storyboard x:Key="InsertListViewItemStoryBoard">
        <DoubleAnimation
                Duration="00:00:0.2" From="0" To="1"                                            
                Storyboard.TargetProperty="(ListBoxItem.RenderTransform).(ScaleTransform.ScaleY)" />
    </Storyboard>

    <Style x:Key="HorizontalLineDividedListBoxItem" TargetType="{x:Type ListBoxItem}">
        <Setter Property="RenderTransform">
            <Setter.Value>
                <ScaleTransform ScaleX="1" ScaleY="1" />
            </Setter.Value>            
        </Setter>
        <Setter Property="Template">            
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Border Background="{TemplateBinding Background}"                            
                            BorderThickness="0,0,0,1" Padding="3" BorderBrush="{StaticResource ItemDivisonLineBrush}">
                        <Border Style="{StaticResource MouseOverBorder}">
                            <ContentPresenter x:Name="content" />
                        </Border>                        
                    </Border>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding JustHasBeenRemoved}" Value="True">
                            <DataTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource RemoveItemStoryBoard}"/>
                            </DataTrigger.EnterActions>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding JustHasBeenInserted}" Value="True">
                            <DataTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource InsertItemStoryBoard}"/>
                            </DataTrigger.EnterActions>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style TargetType="{x:Type ListViewItem}">
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="RenderTransform">
            <Setter.Value>
                <ScaleTransform ScaleX="1" ScaleY="1" />
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListViewItem">

                    <Border Background="{TemplateBinding Background}" BorderThickness="0,0,0,1" Padding="3" BorderBrush="{StaticResource ItemDivisonLineBrush}">
                        <Border Style="{StaticResource MouseOverBorder}" x:Name="border">
                            <GridViewRowPresenter  />
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding JustHasBeenRemoved}" Value="True">
                            <DataTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource RemoveListViewItemStoryBoard}"/>
                            </DataTrigger.EnterActions>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding JustHasBeenInserted}" Value="True">
                            <DataTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource InsertListViewItemStoryBoard}"/>
                            </DataTrigger.EnterActions>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="ItemsControl.AlternationIndex" Value="0">
                <Setter Property="Background" Value="Transparent"/>
            </Trigger>
            <Trigger Property="ItemsControl.AlternationIndex" Value="1">
                <Setter Property="Background" Value="{StaticResource AlternateRowBackgroundBrush}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type ListViewItem}" x:Key="NoHoverListViewItem">
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="RenderTransform">
            <Setter.Value>
                <ScaleTransform ScaleX="1" ScaleY="1" />
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListViewItem">

                    <Border Background="{TemplateBinding Background}" BorderThickness="0,0,0,1" Padding="3" BorderBrush="{StaticResource ItemDivisonLineBrush}">
                        
                            <GridViewRowPresenter  />
                        
                    </Border>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding JustHasBeenRemoved}" Value="True">
                            <DataTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource RemoveListViewItemStoryBoard}"/>
                            </DataTrigger.EnterActions>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding JustHasBeenInserted}" Value="True">
                            <DataTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource InsertListViewItemStoryBoard}"/>
                            </DataTrigger.EnterActions>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="ItemsControl.AlternationIndex" Value="0">
                <Setter Property="Background" Value="Transparent"/>
            </Trigger>
            <Trigger Property="ItemsControl.AlternationIndex" Value="1">
                <Setter Property="Background" Value="{StaticResource AlternateRowBackgroundBrush}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type ListView}" >
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="AlternationCount" Value="2"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>      
        <Setter Property="Template">            
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListView}">


                    <DockPanel>
                        <Border
                            DockPanel.Dock="Top"
                            Background="{StaticResource GridHeaderBackground}" CornerRadius="5,5,5,5" Padding="2">
                            <GridViewHeaderRowPresenter
                                    Columns="{Binding Path=View.Columns, RelativeSource={RelativeSource TemplatedParent}}"
                                    ColumnHeaderContainerStyle="{Binding Path=View.ColumnHeaderContainerStyle,
                                    RelativeSource={RelativeSource TemplatedParent}}"
                                    ColumnHeaderTemplate="{Binding Path=View.ColumnHeaderTemplate, RelativeSource={RelativeSource TemplatedParent}}"
                                    ColumnHeaderTemplateSelector="{Binding Path=View.ColumnHeaderTemplateSelector, RelativeSource={RelativeSource TemplatedParent}}"
                                    AllowsColumnReorder="{Binding Path=View.AllowsColumnReorder, RelativeSource={RelativeSource TemplatedParent}}"
                                    ColumnHeaderContextMenu="{Binding Path=View.ColumnHeaderContextMenu, RelativeSource={RelativeSource TemplatedParent}}"
                                    ColumnHeaderToolTip="{Binding Path=View.ColumnHeaderToolTip, RelativeSource={RelativeSource TemplatedParent}}"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </Border>
                        <ScrollViewer>
                            <ItemsPresenter HorizontalAlignment="Stretch" />
                        </ScrollViewer>
                    </DockPanel>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style TargetType="{x:Type GridViewColumnHeader}">
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="Foreground" Value="{StaticResource GridHeaderForeground}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                    <Grid SnapsToDevicePixels="true"
                          Background="{TemplateBinding Background}">
                        <Border BorderThickness="{TemplateBinding BorderThickness}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                Padding="{TemplateBinding Padding}"
                                Margin="1,0,1,0">
                            <ContentPresenter x:Name="HeaderContent"
                                              Margin="5,0,0,1"
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              RecognizesAccessKey="True"
                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                                <ContentPresenter.Resources>
                                    <Style TargetType="{x:Type TextBlock}">
                                        <Setter Property="FontSize" Value="{StaticResource SmallFontSize}"/>                                        
                                    </Style>
                                </ContentPresenter.Resources>
                            </ContentPresenter>
                        </Border>
                        <Thumb
                                x:Name="PART_HeaderGripper"
                                HorizontalAlignment="Right"
                                Margin="0"
                                Width="2" >
                            <Thumb.Style>
                                <Style TargetType="Thumb">
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="{x:Type Thumb}">
                                                <Border Width="3" Background="Transparent"/>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </Thumb.Style>
                        </Thumb>

                    </Grid>
                    <!--<ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="PART_HeaderGripper" Property="Background" Value="Transparent"/>
                            <Setter Property="Background" Value="#FDFDFD"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="PART_HeaderGripper" Property="Visibility" Value="Hidden"/>
                            <Setter TargetName="HeaderContent" Property="Margin" Value="1,1,0,0"/>
                            <Setter Property="Background" Value="#FDFDFD"/>
                            <Setter Property="BorderBrush" Value="#FDFDFD"/>
                        </Trigger>
                        <Trigger Property="Height" Value="Auto">
                            <Setter Property="MinHeight" Value="20"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>-->
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Role" Value="Floating">
                <Setter Property="Opacity" Value="0.7"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                            <Canvas Name="PART_FloatingHeaderCanvas" />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="Role" Value="Padding">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                            <Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
                                <Border BorderThickness="{TemplateBinding BorderThickness}"
                                        BorderBrush="{TemplateBinding BorderBrush}"
                                        Padding="{TemplateBinding Padding}" 
                                        Margin="1,0,1,0"/>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="Height" Value="Auto">
                                    <Setter Property="MinHeight" Value="20"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>
 
    

    



</ResourceDictionary>